﻿using System;
using Mono.Collections.Generic;

namespace Mono.Cecil
{
	// Token: 0x020000B7 RID: 183
	internal sealed class ParameterDefinitionCollection : Collection<ParameterDefinition>
	{
		// Token: 0x0600078A RID: 1930 RVA: 0x00004AD5 File Offset: 0x00002CD5
		internal ParameterDefinitionCollection(IMethodSignature method)
		{
			this.method = method;
		}

		// Token: 0x0600078B RID: 1931 RVA: 0x00004AE6 File Offset: 0x00002CE6
		internal ParameterDefinitionCollection(IMethodSignature method, int capacity) : base(capacity)
		{
			this.method = method;
		}

		// Token: 0x0600078C RID: 1932 RVA: 0x00004AF8 File Offset: 0x00002CF8
		protected override void OnAdd(ParameterDefinition item, int index)
		{
			item.method = this.method;
			item.index = index;
		}

		// Token: 0x0600078D RID: 1933 RVA: 0x000235C4 File Offset: 0x000217C4
		protected override void OnInsert(ParameterDefinition item, int index)
		{
			item.method = this.method;
			item.index = index;
			for (int i = index; i < this.size; i++)
			{
				this.items[i].index = i + 1;
			}
		}

		// Token: 0x0600078E RID: 1934 RVA: 0x00004AF8 File Offset: 0x00002CF8
		protected override void OnSet(ParameterDefinition item, int index)
		{
			item.method = this.method;
			item.index = index;
		}

		// Token: 0x0600078F RID: 1935 RVA: 0x0002360C File Offset: 0x0002180C
		protected override void OnRemove(ParameterDefinition item, int index)
		{
			item.method = null;
			item.index = -1;
			for (int i = index + 1; i < this.size; i++)
			{
				this.items[i].index = i - 1;
			}
		}

		// Token: 0x0400028B RID: 651
		private readonly IMethodSignature method;
	}
}
